package com.ruoyi.iot.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.iot.domain.IotMasterConfig;
import com.ruoyi.iot.mapper.IotMasterConfigMapper;
import com.ruoyi.iot.service.IIotMasterConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 采集器配置信息Service业务层处理
 *
 * @author ruoyi
 * @date 2025-03-12
 */
@Service
public class IotMasterConfigServiceImpl implements IIotMasterConfigService {
    @Autowired
    private IotMasterConfigMapper iotMasterConfigMapper;

    /**
     * 查询采集器配置信息
     *
     * @param masterId 采集器配置信息主键
     * @return 采集器配置信息
     */
    @Override
    public IotMasterConfig selectIotMasterConfigByMasterId(Long masterId) {
        return iotMasterConfigMapper.selectIotMasterConfigByMasterId(masterId);
    }

    /**
     * 查询采集器配置信息列表
     *
     * @param iotMasterConfig 采集器配置信息
     * @return 采集器配置信息
     */
    @Override
    public List<IotMasterConfig> selectIotMasterConfigList(IotMasterConfig iotMasterConfig) {
        return iotMasterConfigMapper.selectIotMasterConfigList(iotMasterConfig);
    }

    /**
     * 新增采集器配置信息
     *
     * @param iotMasterConfig 采集器配置信息
     * @return 结果
     */
    @Override
    public int insertIotMasterConfig(IotMasterConfig iotMasterConfig) {
        iotMasterConfig.setCreateTime(DateUtils.getNowDate());
        return iotMasterConfigMapper.insertIotMasterConfig(iotMasterConfig);
    }

    /**
     * 修改采集器配置信息
     *
     * @param iotMasterConfig 采集器配置信息
     * @return 结果
     */
    @Override
    public int updateIotMasterConfig(IotMasterConfig iotMasterConfig) {
        iotMasterConfig.setUpdateTime(DateUtils.getNowDate());
        return iotMasterConfigMapper.updateIotMasterConfig(iotMasterConfig);
    }

    /**
     * 批量删除采集器配置信息
     *
     * @param masterIds 需要删除的采集器配置信息主键
     * @return 结果
     */
    @Override
    public int deleteIotMasterConfigByMasterIds(Long[] masterIds) {
        return iotMasterConfigMapper.deleteIotMasterConfigByMasterIds(masterIds);
    }

    /**
     * 删除采集器配置信息信息
     *
     * @param masterId 采集器配置信息主键
     * @return 结果
     */
    @Override
    public int deleteIotMasterConfigByMasterId(Long masterId) {
        return iotMasterConfigMapper.deleteIotMasterConfigByMasterId(masterId);
    }
}
